﻿@page "/dialog"
@inherits BComponentBase

<BButton OnClick="e=>showMyDialog()">不带参数弹窗</BButton>
<BButton OnClick="e=>showMyDialog(123)">带参数弹窗</BButton>
@code {

    [Inject]
    DialogService dialogService { get; set; }

    private async Task showMyDialog(int value = 0)
    {
        if (value > 0)
            await dialogService.ShowDialogAsync<MyDialog>("带参数",
                new Dictionary<string, object> { { "MyParameter", value }, { "myDialog",
                        new Action<MyDialog>(
                            async p =>
                        await dialogService.CloseDialogAsync(p,
                        new DialogResult() { Result=true }
                        )) } });
        else
            await dialogService.ShowDialogAsync<MyDialog>("不带参数");
    }
}